package CB_C19;

import javafx.scene.control.*;
import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;


/**define on/off Effect strenght*/
public var checkBox : CheckBox;
/**Slider: controls brightness of the framedrop effect(0 - 100)
* @defaultvalue 100
*/
public var brightness: Slider;
/**Displays "Brigthness"*/
public var brightness_text : Label;
/**indicates the current Brightness Slider position*/
var brightness_value : Label;

/**Brightness Created on 10.11.2009. <br>
 * <br>
 * Represents the brightness of the framedrop effect(0 - 100) *<br>
 * @author Sebastian Czekierski, Stefan Blumberger
 */
public class gui_Brightness extends CustomNode
{
    override function create(): Node
    {
        return Group
        {
            content:
            [
                checkBox = CheckBox
                {
                    translateX: 5;
                    translateY: 5;
                    text: ""
                    allowTriState: false
                    selected: false;
                }
                brightness_text = Label
                {
                    translateX: checkBox.width + checkBox.translateX;;
                    translateY: 5;
                    text: "Brightness:";
                    width: 80;
                }
                /**Slider to set Brightness*/
                brightness = Slider
                {
                     translateX: brightness_text.width + brightness_text.translateX+10;
                     translateY: 5;
                     width: 300;
                     min: 0;
                     max: 100;
                     value : 100;
                     vertical: false;
                     visible : bind checkBox.selected;
                     onMouseEntered: function(MouseEvent)
                     {
                         var a : Effect_Brightness;
                         a = Main.p.effect.getControl("brightness") as Effect_Brightness;
                         a.setbrightness(brightness.value as Integer);
                     }
                     onMouseExited: function(MouseEvent)
                     {
                         var a : Effect_Brightness;
                         a = Main.p.effect.getControl("brightness") as Effect_Brightness;
                         a.setbrightness(brightness.value as Integer);
                     }
                }
                /**Indicates Current value of Brightness*/
                brightness_value = Label
                {
                    width: 80;
                    translateX: brightness.width + brightness.translateX+10;
                    translateY: 5;
                    text: bind "{brightness.value as Integer} %";
                    visible: bind checkBox.selected;
                }
            ]
        }
    }
}